<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<video autoplay playsinline id="player"></video>
<script src="../static/adapter.js"></script>
<script src="../utils/utils.js"></script>
<script>
  'use strict'

  var $videoPlay = $('video#player')

  /**
   * 获取到视频流， 直接赋值给 video
   * @param stream
   */
  function gotMediaStream (stream) {
    $videoPlay.srcObject = stream
  }

  const { getUserMedia } = window.navigator.mediaDevices
  if (getUserMedia) {
    var constraints = {
      video: true,
      audio: true,
    }
    getUserMedia(constraints)
      .then(gotMediaStream)
      .catch(handleError)
  }
</script>
</body>
</html>
